import request from "@/request/request";
import qs from "qs"


export function getProjectList(data){
    let url = "/admin/project";
    let param = {
        url:url,
        method:"GET",
        params:data
    }
    return request(param);
}



export function saveProject(id,project){
    let method = "post";
    let url = "/admin/project";
    if(id){
        method = "put";
        url = "/admin/project/"+id;
    }

    let param = {
        url:url,
        method:method,
        data:qs.stringify(project)
    }
    return request(param);
}


export function bindEngineer(projectId,engineerId){
    let method = "put";
    let url = `/admin/project/${projectId}/bind/${engineerId}`;
    
    let param = {
        url:url,
        method:method
    }
    return request(param);
}

export function deleteProjectById(id){
    let param = {
        url:"/admin/project/"+id,
        method:"delete"
    }
    return request(param);
}

export function findById(id){
    let param = {
        url:"/admin/project/"+id,
        method:"get"
    }
    return request(param);
}
 




